import FreeCAD
import FreeCADGui
from PySide import QtGui, QtCore

class MySecondCommand:
    def GetResources(self):
        # 菜单图标 菜单名称 菜单提示(在左下角)
        return {'Pixmap': 'freecad', 'MenuText': 'show Message1', 'ToolTip': 'Print show Message1'}

    def Activated(self): #点击按钮执行的动作
        """Do something here"""
        reply = QtGui.QMessageBox.information(None,"","Houston, we have a problem")
        return

    def IsActive(self):
        """Here you can define if the command must be active or not (greyed) if certain conditions
        are met or not. This function is optional."""
        return True

FreeCADGui.addCommand('MySecondCommand01', MySecondCommand())

class MySecondCommand1:
    def GetResources(self):
        return {'Pixmap': 'freecad', 'MenuText': 'show Message2', 'ToolTip': 'Print show Message2'}

    def Activated(self): #点击按钮执行的动作
        """Do something here"""
        reply = QtGui.QMessageBox.question(None, "", "This is your chance to answer, what do you think?",QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No)
        if reply == QtGui.QMessageBox.Yes:
            # this is where the code relevant to a 'Yes' answer goes
            pass
        if reply == QtGui.QMessageBox.No:
            # this is where the code relevant to a 'No' answer goes
            pass
        return

    def IsActive(self):
        """Here you can define if the command must be active or not (greyed) if certain conditions
        are met or not. This function is optional."""
        return True

FreeCADGui.addCommand('MySecondCommand02', MySecondCommand1())
